package com.example.demo.Mappers;

import com.example.demo.beans.YjjlBean;
import com.example.demo.beans.ZyjfcxBean;
import org.apache.ibatis.annotations.*;

import java.util.List;

/** 查询住院预交金额信息
 * Created by Administrator on 2018-06-29.
 */
@Mapper
public interface ZYAddDepositMapper {
@Select("select  rtrim(ylkh)ylkh,rtrim(a.ylklxbm)ylklxbm,  rtrim(a.zyh)zyh ,ylkzhje,ylkzfje,bxlbbm,b.ywckbm,fbbm,ybkh,zyzt,rycwid,rtrim(ryks)ryks,c.brid,brxm,brxb,csrq,sfzh,sj,jtzz from zyb_zyylkxx a with (nolock) left join zyb_rydj b with (nolock) on a.zyh=b.zyh left join zyb_zcxx c with(nolock) on b.brid=c.brid  where a.zyh=#{zyh} and a.ylkh=#{ylkh}")
    ZyjfcxBean getzyjfinfo(@Param("zyh")String zyh,@Param("ylkh")String ylkh);

@Insert("INSERT INTO zyb_yjjl ( ylklxbm, ylkh, zflxbm, czybm, ksbm, zyh, yjrq, yjje ) VALUES " +
 "(#{ylklxbm},#{ylkh},#{zflxbm},#{czybm},#{ksbm}, #{zyh}, #{yjrq},#{yjje})")
    void Zyaddinsert(@Param("ylklxbm")String ylklxbm,@Param("ylkh")String ylkh,@Param("zflxbm")String zflxbm,@Param("czybm")String czybm,@Param("ksbm")String ksbm ,@Param("zyh")String zyh,@Param("yjrq")String yjrq,@Param("yjje")String yjje);

@Update("UPDATE zyb_zyylkxx SET ylkzhje =#{ylkzhje} WHERE ylkh = #{ylkh} AND ylklxbm = #{ylklxbm}  AND zyh =#{zyh} ")
    void Zyupdate(@Param("ylkzhje")double ylkzhje,@Param("ylkh")String ylkh,@Param("ylklxbm")String  ylklxbm,@Param("zyh")String zyh);
@Select("select MAX(IDENTITYCOL)yjjl from zyb_yjjl ")
    String getyjjlid();

@Select(" SELECT  yjjlid,zyh, a.ksbm,yjje,fphm,a.zflxbm,c.zflxmc,a.czybm,b.czyxm,ywckbm,ylklxbm,ylkh,yjrq,czyks, ryjkpzh,    bzms   FROM zyb_yjjl  a  with(nolock) left join gyb_czy b with(nolock) on a.czybm=b.czybm left join gyb_zflx c with(nolock) on a.zflxbm=c.zflxbm WHERE ( a.zyh = #{zyh} ) ")
    List<YjjlBean> getyjjl(@Param("zyh")String zyh);

}
